﻿/**
 *
 * sspi.h
 *
 *  Created on: 2018-09-05
 *      Author: chenshisheng
 */

#ifndef INC_SSPI_H_
#define INC_SSPI_H_

#include "main.h"
#include "hw.h"

typedef struct
{
    HW_Out_t stb;
    HW_Out_t clk;
    HW_Out_t dio;
}SSPI_Bus_t;

void SSPI_Init(void);
void SSPI_SelectCmd(const HW_t *stb, bool select);
void SSPI_SendByte(const HW_t *clk, const HW_t *dio, uint8_t b);
void SSPI_Send(const HW_t *clk, const HW_t *dio, const void *data, unsigned int size);
uint8_t SSPI_RecvByte(const HW_t *clk, const HW_t *dio);
void SSPI_Recv(const HW_t *clk, const HW_t *dio, void *data, unsigned int size);
void SSPI_Idle(const SSPI_Bus_t *bus);
void SSPI_Clk(const HW_t *clk, uint8_t pluse);

#endif /* INC_SSPI_H_ */
